local skel = fk.CreateSkill {
  name = "efengqi__qiqin",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["efengqi__qiqin"] = "绮琴",
  [":efengqi__qiqin"] = "锁定技，游戏开始时，将初始手牌标记为“琴”，“琴”不计入你的手牌上限；出牌阶段开始时，你获得所有“琴”。",

  ["@@efengqi__qiqin"] = "琴",
}

skel:addEffect(fk.GameStart, {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and not player:isKongcheng()
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = player:getCardIds(Player.Hand)
    for _, id in ipairs(cards) do
      room:setCardMark(Fk:getCardById(id), "@@efengqi__qiqin", 1)
    end
    local record = room:getBanner("efengqi__qiqin_record") or {}
    table.insertTableIfNeed(record, cards)
    room:setBanner("efengqi__qiqin_record", record)
  end,
})

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and target == player and player.phase == Player.Play then
      return table.find(player.room:getBanner("efengqi__qiqin_record") or {}, function(id)
        return not table.contains(player:getCardIds("h"), id)
      end)
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local get = table.filter(room:getBanner("efengqi__qiqin_record") or {}, function(id)
      return not table.contains(player:getCardIds("h"), id)
    end)
    room:moveCardTo(get, Player.Hand, player, fk.ReasonJustMove, skel.name, nil, false, player)
  end,
})

skel:addEffect("maxcards", {
  anim_type = "drawcard",
  exclude_from = function(self, player, card)
    return card and card:getMark("@@efengqi__qiqin") ~= 0 and player:hasSkill(skel.name)
  end,
})

return skel
